/*
 * MenuPanel.java
 *
 * Created on September 21, 2008, 4:28 PM
 */
package no.eirikb.bomberman.applet.menu;

import no.eirikb.bomberman.applet.Bomberman;

/**
 *
 * @author  eirikb
 */
public class MenuPanel extends javax.swing.JPanel {

    /** Creates new form MenuPanel */
    public MenuPanel(Bomberman b) {
        initComponents();
        GamelistPanel gameListPanel = new GamelistPanel(b);
        menuPane.add("Gamelist", gameListPanel);
        b.getClient().setGameListPanel(gameListPanel);
        menuPane.add("Profile", new ProfilePanel(b));
        menuPane.add("Create game", new CreateGamePanel(b));
    }

    /*
    public void addGame(Game game) {
    games.put(game.getName(), game);
    // gameList.removeAll();
    // gameList.setListData(games.values().toArray(new Game[games.values().size()]));
    }
    
    public void removeGame(Game game) {
    games.remove(game.getName());
    //gameList.setListData(games.values().toArray(new Game[games.values().size()]));
    }
    
    public void updateGame(Game game) {
    user.setGame(game);
    //  updateGameWaitPlayerList();, ImageIcon bgimage2
    }
    
    public void updateGameWaitPlayerList() {
    //  gameWaitPlayerList.setListData(user.getGame().getUsers().values().toArray());
    //  gameWaitPlayerLabel.setText("Players [" + user.getGame().getUsers().size() + "/" + user.getGame().getMax() + "]:");
    }
    
    public void startGame() {
    //  show(gamePanel);
    new Run().start();
    }
     */
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menuPane = new javax.swing.JTabbedPane();

        setLayout(new java.awt.BorderLayout());

        menuPane.setName("menuPane"); // NOI18N
        menuPane.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                menuPaneStateChanged(evt);
            }
        });
        add(menuPane, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

private void menuPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_menuPaneStateChanged
    /*
    if (menuPane.getSelectedComponent().equals(profilePanel)) {
    updateProfile();
    } else if (menuPane.getSelectedComponent().equals(createGamePanel)) {
    createGameTextField.setText("");
    }
     */
}//GEN-LAST:event_menuPaneStateChanged
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane menuPane;
    // End of variables declaration//GEN-END:variables
}
